// Decompiled by DJ v2.3.3.38 Copyright 2000 Atanas Neshkov  Date: 03/11/2007 6:44:23
// Home Page : http//members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   LoadProperties.java

package ig.formato.util;

import java.io.*;
import java.util.Properties;

public class LoadProperties
{

    public LoadProperties()
    {
    }

    private static void loadProperties(String file)
    {
        props = new Properties();
        f = new File(file);
        String msg = null;
        if(f.exists())
            try
            {
                InputStream is = new BufferedInputStream(new FileInputStream(f));
                props.load(is);
                is.close();
            }
            catch(Exception e)
            {
                e.printStackTrace();
                System.out.println("No se pudo leer el archivo de propiedades.");
            }
    }

    public static Properties loadPropertiess(String file)
    {
        props = new Properties();
        f = new File(file);
        String msg = null;
        if(f.exists())
            try
            {
                InputStream is = new BufferedInputStream(new FileInputStream(f));
                props.load(is);
                is.close();
            }
            catch(Exception e)
            {
                e.printStackTrace();
                System.out.println("No se pudo leer el archivo de propiedades.");
            }
        return props;
    }

    public static boolean storePropertiess(Properties prop, String file, String comentario)
    {
        f = new File(file);
        try
        {
            OutputStream os = new BufferedOutputStream(new FileOutputStream(f));
            prop.store(os, comentario);
            os.flush();
            os.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
            System.out.println("No se pudo Guardar las propiedades.");
            return false;
        }
        return true;
    }

    public static String getProperties(String file, String cadena)
    {
        loadProperties(file);
        msg = props.getProperty(cadena);
        return msg;
    }

    private static Properties props = null;
    private static File f = null;
    private static String msg = null;

}
